package objects;

import java.io.IOException;
import java.io.RandomAccessFile;

public class AddressedObject extends DataObject {
	public int num;

	@Override
	public DataObject readValue( RandomAccessFile file ) throws IOException {
		int index = file.readInt();
		if( index == -1 ) return nullObject;
		return objects.get( index );
	}

	@Override
	public void writeValue( RandomAccessFile file ) throws IOException {
		file.writeInt( num );
	}
	
	@Override
	public boolean isAddressed() {
		return true;
	}
}